package com.shuw.com.beingfortextproject.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;

import com.shuw.com.beingfortextproject.R;
import com.shuw.com.beingfortextproject.base.BaseActivity;
import com.shuw.com.beingfortextproject.service.ResidentService;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

// 写一段进程保活的东西
public class ResidentActivity extends BaseActivity {

	@BindView(R.id.center_title)
	TextView centerTitle;
	@BindView(R.id.toolbar)
	Toolbar toolbar;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_resident);

		ButterKnife.bind(this);
		initView();
	}

	private void initView() {
		centerTitle.setText("服务测试");
		setToolbar(toolbar);
	}

	@OnClick({R.id.startBtn, R.id.endBtn})
	public void onClick(View view) {
		Intent intent = new Intent(this, ResidentService.class);
		switch (view.getId()) {
			case R.id.startBtn:
				System.out.println("启动服务...");
				startService(intent);
				break;
			case R.id.endBtn:
				System.out.println("关闭服务...");
				stopService(intent);
				break;
		}
	}
}
